package cn.net.zidian.mvvm.adapter;


import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chad.library.adapter.base.entity.MultiItemEntity;

import java.util.ArrayList;

import cn.net.zidian.R;
import cn.net.zidian.bean.AstroDetailsBean;
import cn.net.zidian.bean.MultiItemEntityC;

public class AstroDetailsAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity, BaseViewHolder> {
    public AstroDetailsAdapter() {
        super(new ArrayList<>());
        addItemType(1, R.layout.item_astro_details);
        addItemType(2, R.layout.item_astro_details);
    }


    @Override
    protected void convert(BaseViewHolder helper, MultiItemEntity item) {
        if (item.getItemType() == 1) {
            AstroDetailsBean.Today data = ((MultiItemEntityC<AstroDetailsBean.Today>) item).getData();
            helper.setText(R.id.tv_name,  data.getDate() + "运势");
            helper.setText(R.id.tv_info, "概述:" + data.getPresummary()
                    + "\n贵人星座:" + data.getStar()
                    + "\n幸运颜色:" + data.getColor()
                    + "\n幸运数字:" + data.getNumber()
                    + "\n综合运势:" + data.getSummary()
                    + "\n财运运势:" + data.getMoney()
                    + "\n工作运势:" + data.getCareer()
                    + "\n爱情运势:" + data.getLove()
                    + "\n健康运势:" + data.getHealth()
            );
        } else {
            AstroDetailsBean.Month data = ((MultiItemEntityC<AstroDetailsBean.Month>) item).getData();
            helper.setText(R.id.tv_name,  data.getDate() + "运势");
            helper.setText(R.id.tv_info,
                    "综合运势:" + data.getSummary()
                    + "\n财运运势:" + data.getMoney()
                    + "\n工作运势:" + data.getCareer()
                    + "\n爱情运势:" + data.getLove()
            );
        }
    }
}
